﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MONTRASEC_test.Classes;

namespace MONTRASEC_test.ControlsNFP
{
  public partial class wucDVC2Victims : System.Web.UI.UserControl
  {
    //copy this part
    public DetailsView dv
    {
      //change the DetailsView field name
      get { return dvC2Victims; }
      set { dvC2Victims = value; }
    }

    public Label LbTotalRecords
    {
      get { return lbTotalRecords; }
      set { lbTotalRecords = value; }
    }

    public Label LDVMode
    {
      get { return lbDVMode; }
      set { lbDVMode = value; }
    }

    //until here

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void dvC2Victims_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
      e.Values["DIGEST"] = UtilHelper.getHash(e.Values["PERSONALDATA_IDENTITY_NAME"], e.Values["PERSONALDATA_NICKNAME"], e.Values["PERSONALDATA_DATEOFBIRTHOFTHEVICTIM"]);
      e.Values["A_NEWENTRY_ID"] = Session["CurrentANewEntryID"];
      e.Values["PERSONALDATA_DATEOFBIRTHOFTHEVICTIM"] = UtilHelper.getDateTime(e.Values["PERSONALDATA_DATEOFBIRTHOFTHEVICTIM"]);
    }

    protected void dvC2Victims_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
      e.NewValues["DIGEST"] = UtilHelper.getHash(e.NewValues["PERSONALDATA_IDENTITY_NAME"], e.NewValues["PERSONALDATA_NICKNAME"], e.NewValues["PERSONALDATA_DATEOFBIRTHOFTHEVICTIM"]);
      e.NewValues["A_NEWENTRY_ID"] = Session["CurrentANewEntryID"];
      e.NewValues["PERSONALDATA_DATEOFBIRTHOFTHEVICTIM"] = UtilHelper.getDateTime(e.NewValues["PERSONALDATA_DATEOFBIRTHOFTHEVICTIM"]);

    }
    protected void detailsView_ModeChanged(object sender, EventArgs e)
    {
      onDetailsView_ModeChanged(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ModeChangedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ModeChangedHandler DetailsView_ModeChanged;

    protected virtual void onDetailsView_ModeChanged(EventArgs e)
    {
      if (DetailsView_ModeChanged != null)
      {
        DetailsView_ModeChanged(this, e);
      }
    }

    protected void detailsView_ItemDeleted(object sender, DetailsViewDeletedEventArgs e)
    {
      onDetailsView_ItemDeleted(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ItemDeletedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ItemDeletedHandler DetailsView_ItemDeleted;

    protected virtual void onDetailsView_ItemDeleted(EventArgs e)
    {
      if (DetailsView_ItemDeleted != null)
      {
        DetailsView_ItemDeleted(this, e);
      }
    }

    protected void detailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
    {
      onDetailsView_ItemInserted(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ItemInsertedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ItemInsertedHandler DetailsView_ItemInserted;

    protected virtual void onDetailsView_ItemInserted(EventArgs e)
    {
      if (DetailsView_ItemInserted != null)
      {
        DetailsView_ItemInserted(this, e);
      }
    }

    protected void detailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
    {

      onDetailsView_ItemUpdated(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ItemUpdatedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ItemUpdatedHandler DetailsView_ItemUpdated;

    protected virtual void onDetailsView_ItemUpdated(EventArgs e)
    {
      if (DetailsView_ItemUpdated != null)
      {
        DetailsView_ItemUpdated(this, e);
      }
    }
  }
}